package com.hmy.finance.dal.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hmy.finance.dal.po.DeviceProfitLossDetailPo;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author songkf
 * @description 针对表【device_profit_loss_detail(租赁设备损益费用明细表)】的数据库操作Mapper
 * @createDate 2024-02-21 18:55:01
 * @Entity com.hmy.finance.dal.po.DeviceProfitLossDetailPo
 */
public interface DeviceProfitLossDetailMapper extends BaseMapper<DeviceProfitLossDetailPo> {
    /**
     * 批量插入
     *
     * @param deviceProfitLossDetailPoList 租赁设备损益费用明细表
     * @return 影响行数
     * @author songkf
     */
    int insertBatch(@Param("list") List<DeviceProfitLossDetailPo> deviceProfitLossDetailPoList);

    /**
     * 查询具体设备的当天的损益明细
     *
     * @param deviceId 设备ID
     * @return 当天的损益明细集合
     * @author songkf
     */
    List<DeviceProfitLossDetailPo> selectTodayDeviceProfitLossDetailByDeviceId(@Param("deviceId") Long deviceId);

    /**
     * 查询设备的最大报停时间
     *
     * @param deviceRentalRecordId 设备租赁记录ID
     * @return 最大报停时间
     */
    LocalDateTime selectMaxPauseDate(@Param("deviceRentalRecordId") Long deviceRentalRecordId);


    /**
     * 查询到指定截止日期存在的报停
     */
    List<DeviceProfitLossDetailPo> selectDevicePauseLossDetailByDeviceIdAndCutoffDate(@Param("deviceId") Long deviceId, @Param("deviceRentalRecordId") Long deviceRentalRecordId, @Param("cutoffDate") LocalDateTime cutoffDate);


    /**
     * 查询到指定截止日期存在的进场费、退场费、改装费
     */
    List<DeviceProfitLossDetailPo> selectDeviceProfitLossDetailByDeviceIdAndCutoffDate(@Param("statementType") Integer statementType, @Param("deviceId") Long deviceId, @Param("deviceRentalRecordId") Long deviceRentalRecordId, @Param("cutoffDate") LocalDateTime cutoffDate);


}




